
Page({

  /**
   * 页面的初始数据
   */
  data: {
    schema:[
      {
        label: '要传入的值：',
        prop: 'value',
        type: 'text'
      }
    ],
    formData:{
      value: '传入一个值'
    },
    title: '',
    result: '',
    remark: '',
    webUrl: '',
    apiName: ''
  },
  onLoad(options) {
    console.log('options', options)
    wx.setNavigationBarTitle({
      title: options.title,
    })
    
    this.setData({
      title: options.title,
      zh:options.zh,
      remark: options.remark,
      webUrl: options.webUrl
    })
  },
  getFormData(e) {
    this.setData({
      formData: e.detail.formData
    })
  },
  choose1() {
    const that = this;
    wx.navigateTo({
      url: '/packageAPI/pages/route/event-channel/emit-page',
      success(res) {
        try {
          res.eventChannel.emit('acceptDataFromOpenedPage', {
            data: that.data.formData.value
          })
        } catch (err) {
          that.setData({
            result: err,
            apiName: 'EventChannel.emit'
          })
        }
      },
    })
  },
  choose2() {
    const that = this;
    wx.navigateBack({
      delta: 1,
      success(res) {
        that.setData({
          result: res
        })
      },
      fail(res) {
        that.setData({
          result: res
        })
      }
    })
  },
  onUnload() {
  }
})